<?php
	$MaHH = $_REQUEST['MaHH'];
	$sql = "SELECT hh.*, TenLoai, TenCongTy FROM HangHoa hh 
			JOIN Loai lo ON lo.MaLoai=hh.MaLoai
			JOIN NhaCungCap ncc ON ncc.MaNCC=hh.MaNCC
			WHERE MaHH=$MaHH";
	$rows = mysql_query($sql);
	$row = mysql_fetch_array($rows)
?>
<div id="content">
<div class="title_mid"><?php echo $row['TenHH']?></div>
           <div class="sanpham">
           <div class="sp"><a href="Hinh/HangHoa/<?php echo $row['Hinh']?>" class="MagicZoom" rel="zoom-fade: true;"><img src="Hinh/HangHoa/<?php echo $row['Hinh']?>" width="180px" height="180px" /></a></div>
           </div>
		   <div align="left" style="padding:5px"><?php echo $row['MoTa']?></div>
  <div class="price">Giá: $<?php echo $row['DonGia']?></div>
  <div align="right">
  		<a href="?p=MarkAsFavorite&MaHH=<?php echo $MaHH?>&btnMarkAsFavorite=<?php echo $MaHH?>">
			<img src="Hinh/icons/Favourites.png"/>
		</a>
		<a href="?p=SendToFriend&MaHH=<?php echo $MaHH?>&btnSendToFriend=<?php echo $MaHH?>">
			<img src="Hinh/icons/Letter.png"/>
		</a>
		<a href="?p=ProductDetail&MaHH=<?php echo $MaHH?>&btnAddToCart=<?php echo $MaHH?>">
			<img src="Hinh/icons/Add To Basket.png"/>
		</a>
  </div>
</div>
<div class="clean0"></div>
<fieldset style="text-align:left">
<legend>The same category products</legend>
		<table width="100%" border="0">
		<tr>
<?php
$MaLoai = $row["MaLoai"];
$sql = "SELECT MaHH, TenHH FROM HangHoa WHERE MaLoai=$MaLoai AND MaHH != $MaHH";
$rows = mysql_query($sql);
for($i=1;$row = mysql_fetch_array($rows);$i++)
{
	$MaHH = $row['MaHH'];
	$TenHH = $row['TenHH'];
	echo "
		<td width='30'><img src='Hinh/icons/Search.png'/></td>
		<td width='50%'>
			<a href='?p=ProductDetail&MaHH=$MaHH'>$TenHH</a>
		</td>";
	if($i % 2 == 0)
	{
		echo "</tr><tr>";
	}
}
?>			</tr>
		</table>
</fieldset>
</body>
</html>